<template>
    <div class="home">
        <header-nav></header-nav>
        <div class="container">
            <side-bar></side-bar>
            <div class="content">
                <div class="panel">
                    <div class="header">
                        <router-link :to="'/'">
                            <span class="icons fontS18 no-padding"><i class="fa fa-home"></i></span> /
                        </router-link>
                        <span class="selfCenter">{{user_name}} 参与的话题</span>
                    </div>
                    <div class="inner no-padding">
                        <div class="topic_list clear">
                            <list-row-small :datas="replies"></list-row-small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import HeaderNav from "@/components/header/header"
import SideBar from "@/components/sidebar/sidebar"
import ListRowSmall from "@/components/lists/listRowSmall"
import { getListReplies } from "@/service/api"
import { relativeTime } from "@/config/mUtils"

export default {
    data() {
        return {
            replies: [], 
            user_name: '',
            page: 1,
        }
    },
    mounted() {
        this.user_name = this.$route.params.name
        this.getListReplies()
    },
    methods: {
        days(time) {
            return relativeTime(time)
        },
        async getListReplies() {
            let params = {
                loginName: this.$route.params.name,
                page: this.page
            }
            let res = await getListReplies(params)
            // console.log(res)
            if(res.code) {
                this.replies = res.result;
            } else {
                this.$message.error(res.msg)
            }
        }
    },
    components: {
        HeaderNav,
        SideBar,
        ListRowSmall
    }
}
</script>


<style lang="scss" scoped>
    @import '../../style/mixin.scss';
    .container {
        padding-top: 10px;
    }
</style>

